<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>scrollWidth offsetWidth clientWidth区别</title>
  <style>
    .one {
      width: 100px;
      height: 100px;
      background-color: red;
      overflow: auto;
    }
    .two {
      width: 200px;
      height: 200px;
      background-color: yellow;
    }
  </style>
</head>
<body>
  <div class="one">
    <div class="two"></div>
  </div>
  <script>
    var one = document.querySelector('.one')
    console.log('scrollWidth',one.scrollWidth);
    console.log('offsetWidth',one.offsetWidth);
    console.log('clientWidth',one.clientWidth);
  </script>
</body>
</html>